﻿<UserControl
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" 
			 xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" x:Name="userControl" x:Class="EzDesk.DesktopClient.UtilityView.View.UpdateItemView" 
             mc:Ignorable="d" 
             d:DesignHeight="75" d:DesignWidth="300"
             MouseLeftButtonUp="userControl_MouseLeftButtonUp">
    <Grid ClipToBounds="True">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="MouseStates">
                <VisualStateGroup.Transitions>
                    <VisualTransition GeneratedDuration="0:0:0.1"/>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="Normal"/>
                <VisualState x:Name="MouseOver">
                    <Storyboard>
                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="border">
                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource FeedItemBackMouseOverColor}"/>
                        </ColorAnimationUsingKeyFrames>
                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="border">
                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource FeedItemBackMouseOverColor}"/>
                        </ColorAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
            <VisualStateGroup x:Name="ReadStates">
                <VisualStateGroup.Transitions>
                    <VisualTransition GeneratedDuration="0:0:0.1"/>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="Read">
                    <Storyboard>
                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="border">
                            <EasingColorKeyFrame KeyTime="0" Value="#ffe3e3e3"/>
                        </ColorAnimationUsingKeyFrames>
                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="border">
                            <EasingColorKeyFrame KeyTime="0" Value="#ffe3e3e3"/>
                        </ColorAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="Unread">
                    <Storyboard>
                        <!--<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="border">
                            <EasingColorKeyFrame KeyTime="0" Value="White"/>
                        </ColorAnimationUsingKeyFrames>
                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="border">
                            <EasingColorKeyFrame KeyTime="0" Value="White"/>
                        </ColorAnimationUsingKeyFrames>-->
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Border x:Name="border" CornerRadius="5" BorderThickness="1" BorderBrush="#FF999999" ClipToBounds="True">
            <i:Interaction.Behaviors>
                <ei:DataStateBehavior Binding="{Binding IsRead}" Value="true" TrueState="Read" FalseState="Unread"/>
            </i:Interaction.Behaviors>
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop  Color="White" Offset="0"/>
                    <GradientStop  Color="White" Offset="1"/>
                </LinearGradientBrush>
            </Border.Background>
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseEnter">
                    <ei:GoToStateAction StateName="MouseOver"/>
                </i:EventTrigger>
                <i:EventTrigger EventName="MouseLeave">
                    <ei:GoToStateAction StateName="Normal"/>
                </i:EventTrigger>
            </i:Interaction.Triggers>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition  Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="40"/>
                    <ColumnDefinition Width="0.826*"/>
                    <ColumnDefinition Width="15"/>
                </Grid.ColumnDefinitions>
                <Rectangle x:Name="rectangle" Margin="0" HorizontalAlignment="Left" Width="7" Grid.RowSpan="2" Fill="#FF84D44F" StrokeThickness="0" Visibility="{Binding IsRead,Converter={StaticResource TrueToCollapsedFalseToVisibility}}"/>

                <StackPanel HorizontalAlignment="Left" Margin="3,3,0,3" VerticalAlignment="Top"  Grid.Column="1">
                    <Border BorderThickness="1" d:LayoutOverrides="Height" >
                        <Image  Width="25" Height="25" Source="{Binding Path=FeedModel.IconUrl,Converter={StaticResource ImageCacherConverter}}"/>
                    </Border>
                    <ToggleButton Content="ToggleButton" HorizontalAlignment="Center" Margin="0,3,0,0" Style="{DynamicResource StarToggleButton}" Width="15" Height="15"  IsChecked="{Binding IsMark}"/>
                </StackPanel>

                <StackPanel Margin="0,3" Grid.Column="2" >
                    <ContentControl Content="{Binding ContentTitle, Converter={StaticResource XamlConverter}}"  Hyperlink.RequestNavigate="ContentControl_RequestNavigate"/>
                    <ContentControl Content="{Binding ContentBody, Converter={StaticResource XamlConverter}}"  Hyperlink.RequestNavigate="ContentControl_RequestNavigate"/>
                    <TextBlock d:LayoutOverrides="Width, Height" Foreground="#FF666666" Text="{Binding LastUpdate, Converter={StaticResource DatetimeConverter}}"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Grid.Column="2" Grid.ColumnSpan="2" VerticalAlignment="Top" HorizontalAlignment="Right">
                    <!--<Button Style="{StaticResource SetReadButtonStyle}" Visibility="{Binding IsRead,Converter={StaticResource TrueToCollapsedFalseToVisibility}}" Command="{Binding SetFeedReadCommand}" Width="12" Height="12"  Margin="2" Foreground="#FFB5B5B6"></Button>-->
                    <Button Style="{StaticResource CloseButtonStyle}" Command="{Binding DisableFeedCommand}" Width="12" Height="12" Margin="2" Foreground="#FFB5B5B6"></Button>
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</UserControl>
